<script setup lang="ts">

import {computed, ref} from "vue";
import {useCounterStore} from "@/stores/SaveUser";
import {evaluationresults} from "@/http/Personal center";

const onClickLeft = () => history.back();
const id = useCounterStore()
const currentRate = ref(0);
const text = computed(() => currentRate.value.toFixed(0) + '分');

const Idlist = id.title
// console.log(Idlist)
const list = ref({
    pageSize: 10000,
    pageNum: 1,
    assessmentId: +id.title
})
const analysis = ref('')
evaluationresults(list.value).then(res => {
    console.log(res.rows)
    // if (res.rows.<Scoree.score<)
    res.rows.filter(item => {
        console.log(id.Score.score)
        if (+id.Score.score >= +item.lowest && +id.Score.score <= +item.highest) {
            analysis.value = item.analysis
            console.log(item.analysis)
        }
    })
})
// console.log(id.Score)
</script>
<template>
    <div>
        <div>
            <router-link to="/PsychologicalEvaluation">
                <van-nav-bar
                        left-text="测评结果"
                        left-arrow
                />
            </router-link>
            <div class="onex">
                <van-circle
                        v-model:current-rate="currentRate"
                        :rate="+id.Score.score"
                        :speed="100"
                        :text="text"
                />
            </div>
            <div class="twos">
                <p>结果解析</p>
            </div>
            <div class="Words">
                <p>{{ analysis }}</p>
            </div>
        </div>
    </div>
</template>

<style scoped lang="less">
:deep(.van-nav-bar) {
  background-color: #f4f4f4;
}

.onex {
  text-align: center;
  margin: 15px 0px;

  :deep(.van-circle__text) {
    font-size: 20px;
  }
}

.twos {
  text-align: center;
  margin-bottom: 40px;

  p {
    font-size: 18px;
  }
}

.Words {
  width: 85%;
  height: 200px;
  margin: 0 auto;
  background-color: white;

  p {
    padding: 2px 5px;
    word-break: break-all;
  }
}
</style>